import java.util.Arrays;

public class Test {
    public static void main(String[] args) {
        //实现一个方法 transform, 以数组为参数, 循环将数组中的每个元素 乘以 2 ,
        // 并设置到对应的数组元素上. 例如 原数组为 {1, 2, 3}, 修改之后为 {2, 4, 6}
        int[] array = {1,3,6,5,7,6,6};
       /* System.out.println(Arrays.toString(array));
        transForm(array);
        System.out.println(Arrays.toString(array));*/
        //System.out.println(avg(array));
       //int[] cu =  cow(array,9);
        boolean cut = night(array);
        System.out.println(cut);

    }
    public static void transForm(int[] array) {
        for (int i = 0; i < array.length; i++) {
            array[i] = array[i] * 2;
        }
    }
    //实现一个方法 avg, 以数组为参数, 求数组中所有元素的平均值(注意方法的返回值类型).
    public static double avg(int[] array) {
        double dou = 0;
        for (int i = 0; i < array.length; i++) {
           dou += array[i];
        }
        return dou / array.length;
    }
    //奇数在前偶数在后
    public static void reorderOddEven(int[] array) {
        int l = 0;
        int r = array.length-1;
        while (l < r) {
            if((array[l] & 1) == 0 && (array[r] & 1) == 1) {
                int tmp = array[l];
                array[l] = array[r];
                array[r] = tmp;
                l++;
                r--;
            } else if ((array[l] & 1) == 1) {
                l++;
            }else if((array[r] & 1) == 0) {
                r--;
            }
        }
    }
    //给定一个整型数组, 实现冒泡排序(升序排序)
    //doll--洋娃娃，玩偶----wish--希望，愿望，祝福
    public static void doll(int[] wish) {
        //趟数
        for (int i = 0; i < wish.length - 1; i++) {
            //一趟
            for (int j = 0; j < wish.length -1 - i; j++) {
                if(wish[j] > wish[j+1]) {
                    int tmp = wish[j];
                    wish[j] = wish[j+1];
                    wish[j+1] = tmp;
                }
            }
        }
    }
    //数组中找出 和为目标值的那两个整数，并返回它们的数组下标。
    //cute 可爱的---------lion  狮子
    public static int[] cute(int[] taxi, int lion) {

        for (int i = 0; i < taxi.length; i++) {

            for (int j = i + 1; j < taxi.length ; j++) {

                if(taxi[j] + taxi[i] == lion) {

                    return new int[]{i,j};
                }
            }
        }
        return new int[0];
    }
    //找出数组中唯一的数字
    public static int about(int[] an) {
        int after = 0;
        for (int num:an) {
            after = after^num;
        }
        return after;
    }
    //返回数组中多数的数字
    public static int cow(int[] cake) {
        for (int i = 0; i < cake.length; i++) {
            for (int j = 0; j < cake.length - 1 - i; j++) {
                if(cake[j] > cake[j + 1]) {
                    int tmp = cake[j];
                    cake[j] = cake[j + 1];
                    cake[j + 1] = tmp;
                }
            }
        }
        return cake[cake.length / 2];
    }
    //存在连续三个奇数的数组
    public static boolean night(int[] football) {
        int count = 0;
        for (int i = 0; i < football.length; i++) {
            if((football[i] & 1) == 1) {
                count++;
                if(count == 3) {
                   return true;
                }
            } else if ((football[i] & 1)==0) {
                count = 0;
            }
        }
        return false;
    }
}
